package com.william.jdbcplus.test.entity;

import com.william.jdbcplus.common.annotation.*;
import com.william.jdbcplus.common.entity.Entity;
import com.william.jdbcplus.common.enums.IdType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * 病人订单项目 Entity
 */
@Data
@Table(value = "db_order", remarks = "实例表")
@ApiModel("实例表")
@TableIndexs({
        @TableIndex(fields = {"hospCode", "orderDateInOrder"}),
        @TableIndex(fields = {"domainId", "barcode"}),
        @TableIndex(isUnique = true, fields = {"orderUniReqNo"}),
        @TableIndex(fields = {"hospCode", "patId"}),
        @TableIndex(fields = {"hospCode", "orderPatId"}),
        @TableIndex(isUnique = true, fields = {"patBarcode"})
})
@TableUks({
        @TableUk(fields = {"orderPatId"}),
        @TableUk(fields = {"diagnosisCode", "diagnosisName"})
})
public class DbOrder implements Entity {

    private static final long serialVersionUID = 1L;

    @TableId(value = "order_id", size = 32, type = IdType.GUID)
    private String id;

    // 外键关联非主键时，主表字段必须有唯一性约束, 字段长度类型必须一致
    @ApiModelProperty(value = "H表主键")
    @TableColumn(size = 60)
    @TableFk(pkEntity = H.class, pkField = "code")
    private String hCode;

    @TableColumn(value = "order_pat_id", remarks = "病人申请单号", size = 50, nullable = false)
    private String orderPatId;

    @TableColumn(value = "source", remarks = "请求来源", size = 10)
    private Integer source;

    @TableColumn(value = "pat_apply_id", remarks = "检验申请单号", size = 100)
    private String patApplyId;

    @TableColumn(value = "pat_hisid", remarks = "病人在HIS系统分配的唯一ID", size = 100)
    private String patHisId;

    @TableColumn(value = "pat_id", remarks = "病人卡号", size = 100)
    private String patId;

    @TableColumn(value = "pat_id_type", remarks = "病人卡类型", size = 100)
    private String patIdType;

    @TableColumn(value = "pat_medical_recordno", remarks = "病人电子病历档案号", size = 200)
    private String patMedicalRecNo;

    @TableColumn(value = "order_pat_barcode", remarks = "病人唯一号", size = 300)
    private String patBarcode;

    @TableColumn(value = "order_pat_name", remarks = "所属病人姓名", size = 100)
    private String patName;

    @TableColumn(value = "order_pat_sex", remarks = "性别", size = 1)
    private Integer patSex;

    @TableColumn(value = "order_pat_birthtime", remarks = "出生日期", comment = "出生日期，允许包含时间")
    private Date patBirthTime;

    @TableColumn(value = "order_pat_age", size = 10, remarks = "病人年龄", comment = "病人年龄(具体天数)")
    private Integer patAge;

    @TableColumn(value = "order_pat_ageunit", size = 10, remarks = "存储年龄及单位", comment = "存储年龄及单位(包含年龄和年龄单位)")
    private String patAgeShow;

    @TableColumn(value = "order_ptype_id", size = 50, remarks = "病人类型", comment = "病人类型，参考:PTypeEnum")
    private String ptype;

    @TableColumn(value = "order_ptype_name", size = 50, remarks = "病人类型名称", comment = "病人类型名称：查找pat_type获得")
    private String ptypeName;

    @TableColumn(value = "order_invoice_number", size = 50, remarks = "发票号")
    private String invoiceNumber;

    @TableColumn(value = "order_reg_no", remarks = "就诊号", comment = "就诊号:住院号(住院病人)或门诊号(非住院病人)")
    private String regNo;

    @TableColumn(value = "visit_times", remarks = "住院次数", comment = "住院次数")
    private Integer visitTimes;

    @TableColumn(value = "request_no", size = 250, remarks = "项目", comment = "项目(申请组合)申请单号，与order在全系统内一一对应(本身已包含医院编码+orderPatId+orderItemCode)")
    private String orderUniReqNo;

    @TableColumn(value = "order_pat_bed", size = 30, remarks = "床号", comment = "床号")
    private String patBed;

    @TableColumn(value = "diagnosis_code", remarks = "所属诊断编码")
    private String diagnosisCode;

    @TableColumn(value = "diagnosis_name", size = 100, remarks = "所属诊断名称")
    private String diagnosisName;

    @TableColumn(value = "fee_code", remarks = "所属收费类型编码")
    private String feeCode;

    @TableColumn(value = "fee_name", size = 100, remarks = "所属收费类型名称")
    private String feeName;

    @TableColumn(value = "orderitem_union_code", remarks = "套餐组合项目编码")
    private String orderItemUniCode;

    @TableColumn(value = "order_item_id", size = 100, remarks = "医嘱项目id")
    private Long orderItemId;

    @TableColumn(value = "order_item_code", remarks = "医嘱项目编码")
    private String orderItemCode;

    @TableColumn(value = "order_item_name", size = 100, remarks = "医嘱项目名称")
    private String orderItemName;

    @TableColumn(value = "src_orderitem_code", remarks = "就诊医院对应的申请组合项目编码")
    private String srcOrderItemCode;

    @TableColumn(value = "src_orderitem_name", size = 100, remarks = "就诊医院对应的申请组合项目名称")
    private String srcOrderItemName;

    @TableColumn(value = "speciality_code", remarks = "专业组编码")
    private String specCode;

    @TableColumn(value = "speciality_name", size = 100, remarks = "专业组名称")
    private String specName;

    @TableColumn(value = "tube_code", remarks = "试管编码")
    private String tubeCode;

    @TableColumn(value = "tube_name", size = 100, remarks = "试管名称")
    private String tubeName;

    @TableColumn(value = "tube_color", size = 100, remarks = "试管颜色")
    private String tubeColor;

    @TableColumn(value = "sample_type_id", size = 10, remarks = "标本类型id")
    private Long sampleTypeId;

    @TableColumn(value = "sample_type_code", size = 100, remarks = "标本类型编码")
    private String sampleTypeCode;

    @TableColumn(value = "sample_type_name", size = 100, remarks = "标本类型名称")
    private String sampleTypeName;

    @TableColumn(value = "body_id", size = 10, remarks = "采集部位id")
    private Long bodyId;

    @TableColumn(value = "body_code", remarks = "采集部位编码")
    private String bodyCode;

    @TableColumn(value = "body_name", size = 100, remarks = "采集部位名称")
    private String bodyName;

    @TableColumn(value = "exec_officeid", size = 10, remarks = "执行地点id")
    private Long execOfficeId;

    @TableColumn(value = "exec_officecode", remarks = "执行地点编码")
    private String execOfficeCode;

    @TableColumn(value = "exec_officename", size = 100, remarks = "执行地点名称")
    private String execOfficeName;

    @TableColumn(value = "cuvette_number", size = 30, remarks = "和管号")
    private String cuvetteno;

    @TableColumn(value = "order_type", size = 1, remarks = "病人订单项目类型", comment = "0 常规检查，1 急查")
    private Integer orderType = 0;

    @TableColumn(value = "barcode", size = 30, remarks = "条码号", comment = "在domain内部是唯一试管标识")
    private String barcode;

    @TableColumn(value = "src_hosp_barcode", size = 30, remarks = "送检机构自行产生的条码号", comment = "用于送检机构获取报告")
    private String srcHospBarcode;

    @TableColumn(value = "prev_state", size = 10, remarks = "更新为最新状态之前的状态")
    private Integer prevState;

    @TableColumn(value = "state", size = 10, remarks = "当前最新的状态")
    private Integer state;

    @TableColumn(value = "order_date", remarks = "医嘱日期")
    private Date orderDateInOrder;

    @TableColumn(value = "order_time", remarks = "医嘱具体时间")
    private Date orderTime;

    @TableColumn(value = "order_user_code", remarks = "医嘱开单医生编码")
    private String orderUserCode;

    @TableColumn(value = "order_user_name", size = 200, remarks = "医嘱开单医生姓名")
    private String orderUserName;

    @TableColumn(value = "cancel_time", remarks = "医生作废操作的时间")
    private Date cancelTime;

    @TableColumn(value = "col_time", remarks = "护士执行医嘱时间")
    private Date prtBarcodeTime;

    @TableColumn(value = "col_userid", size = 10, remarks = "护士执行医嘱人id")
    private Long prtBarcodeUsrId;

    @TableColumn(value = "col_user_name", size = 200, remarks = "护士执行医嘱人id")
    private String prtBarcodeUsrName;

    @TableColumn(value = "affirm_time", remarks = "确认时间")
    private Date affirmTime;

    @TableColumn(value = "affirm_user_code", remarks = "确认人编码")
    private String affirmUserCode;

    @TableColumn(value = "affirm_user_name", size = 200, remarks = "确认人姓名")
    private String affirmUserName;

    @TableColumn(value = "send_time", remarks = "院内护送时间")
    private Date sendTime;

    @TableColumn(value = "send_usercode", remarks = "院内护送人编码")
    private String sendUserCode;

    @TableColumn(value = "send_user_name", size = 200, remarks = "院内护送人姓名")
    private String sendUserName;

    @TableColumn(value = "sign_time", remarks = "院内核收时间")
    private Date signTime;

    @TableColumn(value = "sign_userid", size = 10, remarks = "院内核收人id")
    private Long signUserId;

    @TableColumn(value = "sign_user_name", remarks = "院内核收人姓名")
    private String signUserName;

    @TableColumn(value = "pack_id", size = 18, remarks = "外送标本包裹单Id")
    private Long packInfoId;

    @TableColumn(value = "pack_serial", size = 30, remarks = "外送标本包裹单的外送序列号", comment = "冗余加快查询速度，避免搜索packInfo表")
    private String packSerial;

    @TableColumn(value = "pack_express_serial", size = 30, remarks = "外送标本包裹单快递单号", comment = "用于物流公司检索")
    private String expressSerial;

    @TableColumn(value = "pack_exp_company_id", size = 10, remarks = "外送标本包裹单的物流公司主键id")
    private Long packExpCompanyId;

    @TableColumn(value = "pack_send_time", remarks = "标本外送时间")
    private Date packSendTime;

    @TableColumn(value = "pack_signin_time", remarks = "标本在检验医院的签收时间")
    private Date packSignInTime;

    @TableColumn(value = "pack_signer_code", remarks = "标本在检验医院的签收人id")
    private String packSignerCode;

    @TableColumn(value = "pack_signer_name", size = 200, remarks = "标本在检验医院的签收人姓名")
    private String packSignerName;

    @TableColumn(value = "order_reject_id", size = 32, remarks = "关联病人订单项目拒收id")
    private String orderRejectId;

    @TableColumn(value = "order_untread_id", size = 32, remarks = "关联病人订单项目退回id")
    private String orderUntreadId;

    @TableColumn(value = "test_time", remarks = "开始测试时间")
    private Date testTime;

    @TableColumn(value = "test_usercode", remarks = "开始测试人编码")
    private String testUserCode;

    @TableColumn(value = "test_user_name", size = 200, remarks = "开始测试人姓名")
    private String testUserName;

    @TableColumn(value = "report_got_time", remarks = "获取到报告的时间")
    private Date reportGotTime;

    @TableColumn(value = "first_audit_time", remarks = "初级审核时间")
    private Date firstAuditTime;

    @TableColumn(value = "first_userid", size = 10, remarks = "初级审核人id")
    private Long firstUserId;

    @TableColumn(value = "first_user_name", size = 200, remarks = "初级审核人姓名")
    private String firstUserName;

    @TableColumn(value = "audit_time", remarks = "审核时间")
    private Date auditTime;

    @TableColumn(value = "audit_usercode", remarks = "审核人id")
    private String auditUserCode;

    @TableColumn(value = "audit_user_name", size = 200, remarks = "审核人姓名")
    private String auditUserName;

    @TableColumn(value = "print_time", remarks = "报告打印时间")
    private Date prtReportTime;

    @TableColumn(value = "print_userid", size = 10, remarks = "报告打印人id")
    private Long prtReportUsrId;

    @TableColumn(value = "print_user_name", size = 200, remarks = "报告打印人姓名")
    private String prtReportUsrName;

    @TableColumn(value = "test_no", size = 50, remarks = "标本编号")
    private String testNo;

    @TableColumn(value = "test_no_date", remarks = "编号日期")
    private Date testNoDate;

    @TableColumn(value = "inst_id", size = 10, remarks = "测试仪器id")
    private Long instId;

    @TableColumn(value = "inst_code", size = 100, remarks = "测试仪器编码")
    private String instCode;

    @TableColumn(value = "inst_name", size = 100, remarks = "测试仪器名称")
    private String instName;

    @TableColumn(value = "domain_id", size = 10, remarks = "所属区域云id")
    private Long domainId;

    @TableColumn(value = "the3rd_plat_id", size = 10, remarks = "该医院所属的第三方平台")
    private Long the3rdPlatId;

    @TableColumn(value = "hosp_id", size = 10, remarks = "医院id")
    private Long hospId;

    @TableColumn(value = "hosp_code", size = 100, remarks = "就诊医院系统编码")
    private String hospCode;

    @TableColumn(value = "hosp_name", size = 200, remarks = "医院名称")
    private String hospName;

    @TableColumn(value = "dst_hosp_id", size = 10, remarks = "标本送往医院")
    private Long dstHospId;

    @TableColumn(value = "dst_hosp_code", size = 100, remarks = "外送医院系统编码")
    private String dstHospCode;

    @TableColumn(value = "dst_hosp_name", size = 200, remarks = "标本送往医院")
    private String dstHospName;

    @TableColumn(value = "depart_id", size = 10, remarks = "科室id")
    private Long departId;

    @TableColumn(value = "depart_code", remarks = "科室id")
    private String departCode;

    @TableColumn(value = "depart_name", size = 100, remarks = "科室名称")
    private String departName;

    @TableColumn(value = "exe_depart_code", remarks = "执行科室编码")
    private String exeDepartCode;

    @TableColumn(value = "exe_depart_name", size = 100, remarks = "执行科室名称")
    private String exeDepartName;

    @TableColumn(value = "area_code", remarks = "病区编码")
    private String areaCode;

    @TableColumn(value = "area_name", size = 100, remarks = "病区名称")
    private String areaName;

    @TableColumn(value = "cost", size = 10, digits = 2, remarks = "收费")
    private Double cost;

    @TableColumn(value = "costflag", size = 10, remarks = "收费类型")
    private Integer costflag = 0;

    @TableColumn(value = "how_to_pay", size = 10, remarks = "结算方式 1、现结;2、月结;3、日结")
    private Integer howToPay = 5;

    @TableColumn(value = "isbingbarcode", size = 1, remarks = "是否绑定条码")
    private Integer isbingbarcode;

    @TableColumn(value = "sync_state", size = 10, remarks = "同步状态", comment = "0没有同步，1已发送至检验医院，2已收到检验医院的成功消息")
    private Integer syncState = 0;

    @TableColumn(value = "remark", size = 1000, remarks = "医嘱备注")
    private String remark;

    @TableColumn(value = "pat_diag_remark", size = 1000, remarks = "病人检验医嘱的整体备注说明")
    private String patDiagRemark;

    @TableColumn(value = "appolintment_date", remarks = "预约日期")
    private Date appointmentDate;

    @TableColumn(value = "appolintment_time", remarks = "预约结束日期")
    private String appointmentTime;

}
